package kgame5.k3d.core.render.layerrender.impl.zbuffer {
import kgame5.k3d.core.math.Vector3D;
import kgame5.k3d.core.obj3d.info.geometry.Face3D;

/**
 * @author kangkai
 * 为了NX的zbuffer工作模式而使用
 * 注意这个因为是往bmd画的，而我引擎是世界居中在舞台中心的，所以有个偏移
 */
class NXFace3DWraper {
	public var tvlist:Array;//屏幕上的点
	public var tlist:Array;//uv贴图
	public function NXFace3DWraper(face:Face3D,W2:int,H2:int){
		tvlist=new Array();
		tvlist.push(new Vector3D(face.v0.screenX+W2,face.v0.screenY+H2,face.v0.screenZ));
		tvlist.push(new Vector3D(face.v1.screenX+W2,face.v1.screenY+H2,face.v1.screenZ));
		tvlist.push(new Vector3D(face.v2.screenX+W2,face.v2.screenY+H2,face.v2.screenZ));
		
		var bmdWidth:int = face.mi.bmd.width;
		var bmdHeight:int = face.mi.bmd.height;
		
		tlist=new Array();
		tlist.push(new Vector3D(face.uvtData[0]*bmdWidth,face.uvtData[1]*bmdHeight,0));
		tlist.push(new Vector3D(face.uvtData[2]*bmdWidth,face.uvtData[3]*bmdHeight,0));
		tlist.push(new Vector3D(face.uvtData[4]*bmdWidth,face.uvtData[5]*bmdHeight,0));
		
////		tlist.push(new Vector3D(face.uvtData[1]*H2*2,face.uvtData[0]*W2*2,0));
////		tlist.push(new Vector3D(face.uvtData[3]*H2*2,face.uvtData[2]*W2*2,0));
////		tlist.push(new Vector3D(face.uvtData[5]*H2*2,face.uvtData[4]*W2*2,0));
//		
//		tlist.push(new Vector3D(face.uvtData[0]*H2*2,face.uvtData[1]*W2*2,0));
//		tlist.push(new Vector3D(face.uvtData[2]*H2*2,face.uvtData[3]*W2*2,0));
//		tlist.push(new Vector3D(face.uvtData[4]*H2*2,face.uvtData[5]*W2*2,0));
	}
}//end of class
}
